<script setup>
import InvoiceCreate from '/src/views/crm/invoice/Create.vue'
import CustomerCreate from '/src/views/crm/customer/Create.vue'
import ContactsCreate from '/src/views/crm/contacts/Create.vue'
import LeadsCreate from '/src/views/crm/leads/Create.vue'
import BusinessCreate from '/src/views/crm/business/Create.vue'
import ContractCreate from '/src/views/crm/contract/Create.vue'
import ReceivablesCreate from '/src/views/crm/receivables/Create.vue'
import ReceivablesPlanCreate from '/src/views/crm/receivablesPlan/Create.vue'
import VisitCreate from '/src/views/crm/visit/Create.vue'
import ProductCreate from '/src/views/crm/product/Create.vue'
import  {defineOptions,computed,onMounted,} from "vue"

defineOptions({
  name: "CRMAllCreate",
  inheritAttrs: false,
})

const  props = defineProps({
  crmType: String
},)

const componentName = computed(()  => {
  return {
    invoice: InvoiceCreate,
    customer: CustomerCreate,
    contacts: ContactsCreate,
    leads: LeadsCreate,
    business: BusinessCreate,
    contract: ContractCreate,
    receivables: ReceivablesCreate,
    visit: VisitCreate,
    product: ProductCreate,
    receivablesPlan: ReceivablesPlanCreate
  }[props.crmType]
})

onMounted(() => {

})


const emits = defineEmits(['close'])
function hiddenView() {
  emits('close')
}
</script>

<template>
  <component :is="componentName" v-bind="$attrs" v-on:hiden-view="hiddenView" v-on:close="hiddenView"/>
</template>

<style lang="scss" scoped>
</style>
